<template>
<div>
    <div style="margin-left: 20px;">
    <h3>修改仓库</h3>
    </div>
    <el-form style="width:70%" :model="form" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
        <el-form-item label="仓库名称">
          <el-input class="taskAdd-row-title" placeholder="请输入内容" size="medium" v-model="form.name" clearable></el-input>
        </el-form-item>
        <el-form-item label="仓库路径">
          <el-input class="taskAdd-row-title" placeholder="请输入内容" size="medium" v-model="form.gitUrl" clearable></el-input>
        </el-form-item>
        <el-form-item  label="负责人" style="margin-bottom:0px">
             <selectRoleTwo type='warehouse' selectType='singleChoice' :masterUserId='form.masterUserId'  style="width:100%" @selectsuccess='selectsuccess'></selectRoleTwo>
        </el-form-item>
                <!-- <el-form-item  label="成员" style="margin-bottom:0px">
             <selectRoleTwo type='warehouse'  selectType='multipleChoice' style="width:100%;" @selectsuccess='selectsuccessmamber'></selectRoleTwo>
        </el-form-item> -->
        <el-form-item label='简介'>
            <el-input type="textarea" :rows="5" placeholder="请输入内容" v-model="form.content"></el-input>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="submitForm('form')">立即修改</el-button>
            <el-button @click="resetForm">取消</el-button>
        </el-form-item>
    </el-form>



</div>
</template>
<script>
import {queryById,update} from '@/api/git'
import quillEditor from '@/components/quillEditor/index'
 import multipleChoiceTags from '@/components/select/multipleChoiceTags'
  import selectRoleTwo from '@/components/screen/selectRoleTwo'
 export default({
     name:"warehouseedit",
     components: {
       quillEditor,
       selectRoleTwo
     },
     data () {
         return {
               options: [{
          value: '选项1',
          label: 'Java'
        }, {
          value: '选项2',
          label: 'C'
        }, {
          value: '选项3',
          label: 'C++'
        }, {
          value: '选项4',
          label: 'python'
        }, {
          value: '选项5',
          label: 'Edit'
        }],
            form:{
               name:"",
               gitUrl:"",
               content:"",
               masterUserId:""
             },
             rules: {
                 name: [
                     { required: true, message: '请输入活动名称', trigger: 'blur' },
                     ],
                 gitUrl: [
                     { required: true, message: '请输入仓库地址', trigger: 'blur' },
                     ],
            },
            warehouse:[
                {
                label:"第一仓库",
                value:1
                 },
                {
                label:"第一仓库",
                value:12
                 },
            ]
         }
     },
     created () {
       this.queryByIdclick()
     },
     methods: {
       selectsuccessmamber(){},
       selectsuccess(data){
         this.form.masterUserId=data[0].userId
       },
         queryByIdclick(){
            let params = new URLSearchParams()
            params.append('id', this.$route.query.gitId)
           queryById(params).then(res=>{
              this.form=res.data
           })
         },
         selectsuccessmamber(data){
             console.log(data);
         },
        submitForm(){
            update(this.form).then(res=>{
              this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => {
                this.$router.go(-1)
                })// 关闭当前tab回到列表   

            })
         },
         resetForm(){
           this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => {
                this.$router.go(-1)
              })// 关闭当前tab回到列表    
         }
     }
 })
</script>
 <style scoped>
 .avatar{
     border-radius: 50%;
     width: 30px;
     /* height: 30px; */
 }
 .milepostselect{
     display: flex;
     align-items: center;
     margin-bottom: 20px;
     /* height: 50px; */
     /* background-color: blanchedalmond; */
     justify-content: space-between;
 }
 .milepostselect_div{
      display: flex;
     align-items: center;
 }
 .milepstdate{
     display: flex;
     width: 100%;
 }
</style>
